<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>文字与视频结合效果</title>
  <link rel="stylesheet" href="style.css">
</head>

<body>
  <section class="sec">
    <video autoplay muted loop>
      <source src="./video.mp4" type="video/mp4">
    </video>
    <h2>Run</h2>
    <div class="dot"></div>
  </section>
</body>
<script>
  const dot = document.querySelector('.dot')
  const sec = document.querySelector('.sec')

  dot.onclick = () => {
    dot.classList.toggle('active')
    sec.classList.toggle('active')
  }

  document.addEventListener('mousemove', (e) => {
    const dot = document.querySelector('.dot')
    dot.style.left = e.pageX + 'px'
    dot.style.top = e.pageY + 'px'
  })
</script>

</html>